local skel = fk.CreateSkill({
  name = "kpaI__yiqisheng",
})

Fk:loadTranslationTable{
  ["kpaI__yiqisheng"] = "以奇胜",
  [":kpaI__yiqisheng"] = "当你使用或成为【杀】的唯一目标后，使用者/目标角色可以同时弃置/摸至多三张牌并执行前等量项：1.令此【杀】无次数限制；2.令此【杀】不能被响应；3.令此【杀】伤害翻倍。",

  ["#kpaI__yiqisheng_aks1"] = "以奇胜：你可以弃置至多三张牌并执行前等量项：1.令此【杀】无次数限制；<br>2.令此【杀】不能被响应；3.令此【杀】伤害翻倍",
  ["#kpaI__yiqisheng_aks2"] = "以奇胜：你可以摸至多三张牌并执行前等量项：1.令此【杀】无次数限制；<br>2.令此【杀】不能被响应；3.令此【杀】伤害翻倍",

  ["$kpaI__yiqisheng1"] = "伏兵十队，使做困兽之斗！",
  ["$kpaI__yiqisheng2"] = "举兵而东，三秦可传檄而定！",
}

skel:addEffect(fk.TargetSpecified, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and data.card.trueName == "slash" and
    data:isOnlyTarget(data.to) and ( target == player or data.to == player )
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:notifySkillInvoked(player, skel.name)
    player:broadcastSkillInvoke(skel.name)
    local room = player.room
    local from = target
    local to = data.to
    local cardsa = room:askToChooseCards(from,{
      min = 0,
      max = 3,
      target = from,
      flag = "he",
      skill_name = skel.name,
      prompt = "#kpaI__yiqisheng_aks1",
    })
    local cardsb = room:askToChoice(to,{
      skill_name = skel.name,
      choices = {"0","1","2","3"},
      prompt = "#kpaI__yiqisheng_aks2",
    })
    local numb = tonumber(cardsb) or 0
    --
    if #cardsa > 0 then
      room:throwCard(cardsa,skel.name,from,from)
    end
    if numb > 0 then
      room:drawCards(to,numb,skel.name)
    end
    --
    numb = math.max(#cardsa,numb)
    if numb > 0 then
      if not data.use.extraUse then
        data.use.extraUse = true
        from:addCardUseHistory(data.card.trueName, -1)
      end
    end
    if numb > 1 then
      data.disresponsive = true
    end
    if numb > 2 then
      room:setCardMark(data.card,"kpaI__yiqisheng",1)
    end
    --
  end,
})

skel:addEffect(fk.DamageCaused, {
  can_refresh = function(self, event, target, player, data)
    return data.card and data.card:getMark("kpaI__yiqisheng") > 0
  end,
  on_refresh = function (self, event, target, player, data)
    data.damage = data.damage * 2
    player.room:setCardMark(data.card,"kpaI__yiqisheng",0)
  end
})


return skel